//
//  NetworkConfigViewController.m
//  APJ HRadar
//
//  Created by Richard Zhao on 3/7/14.
//  Copyright (c) 2014 APJ. All rights reserved.
//

#import "NetworkConfigViewController.h"
#import "Const.h"

@interface NetworkConfigViewController ()

@end

@implementation NetworkConfigViewController
@synthesize popView;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
    serverAddress.text = [[NSUserDefaults standardUserDefaults] stringForKey:SERVER_ADDRESS_KEY];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)ok:(id)sender {
    [[NSUserDefaults standardUserDefaults] setValue:serverAddress.text forKey:SERVER_ADDRESS_KEY];
    [[popView delegate] popoverControllerDidDismissPopover:popView];
}

- (IBAction)cancel:(id)sender {
    [[popView delegate] popoverControllerDidDismissPopover:popView];
}

@end
